/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.itschapala.com.dsw2.modelo;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author z
 */
@Entity
@Table(name = "articulo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Articulo.findAll", query = "SELECT a FROM Articulo a"),
    @NamedQuery(name = "Articulo.findByIdArticulo", query = "SELECT a FROM Articulo a WHERE a.idArticulo = :idArticulo"),
    @NamedQuery(name = "Articulo.findByNombre", query = "SELECT a FROM Articulo a WHERE a.nombre = :nombre"),
    @NamedQuery(name = "Articulo.findByCantidad", query = "SELECT a FROM Articulo a WHERE a.cantidad = :cantidad"),
    @NamedQuery(name = "Articulo.findByFechaIngreso", query = "SELECT a FROM Articulo a WHERE a.fechaIngreso = :fechaIngreso"),
    @NamedQuery(name = "Articulo.findByUsuario", query = "SELECT a FROM Articulo a WHERE a.usuario = :usuario"),
    @NamedQuery(name = "Articulo.findByCosto", query = "SELECT a FROM Articulo a WHERE a.costo = :costo"),
    @NamedQuery(name = "Articulo.findByProveedor", query = "SELECT a FROM Articulo a WHERE a.proveedor = :proveedor"),
    @NamedQuery(name = "Articulo.findByMateriales", query = "SELECT a FROM Articulo a WHERE a.materiales = :materiales"),
    @NamedQuery(name = "Articulo.findByInventarioIdinventario", query = "SELECT a FROM Articulo a WHERE a.inventarioIdinventario = :inventarioIdinventario")})
public class Articulo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idArticulo")
    private Integer idArticulo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "nombre")
    private String nombre;
    @Column(name = "cantidad")
    private Integer cantidad;
    @Column(name = "fecha  ingreso")
    @Temporal(TemporalType.DATE)
    private Date fechaIngreso;
    @Size(max = 45)
    @Column(name = "usuario")
    private String usuario;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "costo")
    private Float costo;
    @Size(max = 45)
    @Column(name = "proveedor")
    private String proveedor;
    @Size(max = 45)
    @Column(name = "materiales")
    private String materiales;
    @Column(name = "inventario_idinventario")
    private Integer inventarioIdinventario;
    @JoinColumn(name = "Inventario Almacen_idInventario", referencedColumnName = "idInventario")
    @ManyToOne(optional = false)
    private InventarioAlmacen inventarioAlmacenidInventario;

    public Articulo() {
    }

    public Articulo(Integer idArticulo) {
        this.idArticulo = idArticulo;
    }

    public Articulo(Integer idArticulo, String nombre) {
        this.idArticulo = idArticulo;
        this.nombre = nombre;
    }

    public Integer getIdArticulo() {
        return idArticulo;
    }

    public void setIdArticulo(Integer idArticulo) {
        this.idArticulo = idArticulo;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public Integer getCantidad() {
        return cantidad;
    }

    public void setCantidad(Integer cantidad) {
        this.cantidad = cantidad;
    }

    public Date getFechaIngreso() {
        return fechaIngreso;
    }

    public void setFechaIngreso(Date fechaIngreso) {
        this.fechaIngreso = fechaIngreso;
    }

    public String getUsuario() {
        return usuario;
    }

    public void setUsuario(String usuario) {
        this.usuario = usuario;
    }

    public Float getCosto() {
        return costo;
    }

    public void setCosto(Float costo) {
        this.costo = costo;
    }

    public String getProveedor() {
        return proveedor;
    }

    public void setProveedor(String proveedor) {
        this.proveedor = proveedor;
    }

    public String getMateriales() {
        return materiales;
    }

    public void setMateriales(String materiales) {
        this.materiales = materiales;
    }

    public Integer getInventarioIdinventario() {
        return inventarioIdinventario;
    }

    public void setInventarioIdinventario(Integer inventarioIdinventario) {
        this.inventarioIdinventario = inventarioIdinventario;
    }

    public InventarioAlmacen getInventarioAlmacenidInventario() {
        return inventarioAlmacenidInventario;
    }

    public void setInventarioAlmacenidInventario(InventarioAlmacen inventarioAlmacenidInventario) {
        this.inventarioAlmacenidInventario = inventarioAlmacenidInventario;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idArticulo != null ? idArticulo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Articulo)) {
            return false;
        }
        Articulo other = (Articulo) object;
        if ((this.idArticulo == null && other.idArticulo != null) || (this.idArticulo != null && !this.idArticulo.equals(other.idArticulo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mx.itschapala.com.dsw2.modelo.Articulo[ idArticulo=" + idArticulo + " ]";
    }
    
}
